﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class CalendarManage_See : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //this.TextBox2.Text = Request["day"].ToString();

            if (Request["id"] != null)
            {
                int id = Convert.ToInt32(Request["id"].ToString());
                ArrayList al = new ArrayList();
                Sqlselete sl = new Sqlselete();
                al = sl.SelectCalendars(id);

                this.TextBox2.Text = al[2].ToString();
                this.txName.Value = al[0].ToString();
                this.txDes.Value = al[1].ToString();



            }

        }
    }
    protected void bnSave_ServerClick(object sender, EventArgs e)
    {
        if (this.txDes.Value.Trim() == "" || this.txName.Value.Trim() == "" || this.TextBox2.Text.Trim() == "")
        {
            Response.Write("<script>alert('请输入详细信息!!')</script>");
        }
        else
        {

            string sql="update Calendar set Motif='"+this.txName.Value.Trim()+"',Content='" + this.txDes.Value.Trim()+ "',addtime='" + this.TextBox2.Text + "'  where CalendarID='" + Request["id"].ToString() + "'";
            SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);
            con.Open();
            SqlCommand com = new SqlCommand(sql,con);
            com.ExecuteNonQuery();
            Response.Write("<script>alert('修改成功！！')</script>");
            con.Close();
        }
    }
}
